package top.misspro.valheimadminsocket.factory;

import org.springframework.stereotype.Component;
import top.misspro.valheimadminsocket.event.*;
import top.misspro.valheimadminsocket.message.Action;

/**
 * 事件工厂
 *
 * @author liulinbo
 */
@Component
public class ServerEventFactory {
    public ServerEventListener getEvent(Action.Server action) {
        ServerEventListener serverEventListener;
        switch (action) {
            case CONNECT:
                serverEventListener = new ConnectEventListener();
                break;
            case INSTALL:
                serverEventListener = new InstallEventListener();
                break;
            case START:
                serverEventListener = new StartEventListener();
                break;
            case RESTART:
                serverEventListener = new RestartEventListener();
                break;
            case UPDATE:
                serverEventListener = new UpdateEventListener();
                break;
            default:
                serverEventListener = null;
        }
        return serverEventListener;
    }

}
